
uniform sampler2D normalBuffer;
uniform int primitive;

uniform vec2 nbSize;

void main (void) {    
    vec2 oo_fbo_size = 1.0 / vec2(nbSize); // (one_over_buffer_size)
    
    //vec2 texCoord = vec2(floor(gl_FragCoord.st) * oo_fbo_size);
    
    //intel gm965 bug: y ao contrario
    vec2 texCoord = vec2(floor(vec2(gl_FragCoord.s, nbSize.y - gl_FragCoord.t)) * oo_fbo_size);
    
    vec4 data = texture2D (normalBuffer, texCoord.st);
    if (primitive == 9 && data.a == 0.0) discard;
    
    gl_FragColor = gl_Color;
}
